{extend name="base"/}
{block name="main"}
<div class="Hui-article">
    <article class="cl pd-20">
        <div class="n_tab_line">
            <a href="{:url('Role/permission')}" class="n_tab_list">用户列表</a>

            <div onclick="layer_open('添加用户','__CONF_SITE__admin/Role/add_user',600,400)" class="n_tab_add"><i class="Hui-iconfont">&#xe600;</i>添加用户</div>
        </div>
        <div class="cl pd-5 bg-1 bk-gray mt-20">
            <form class="Huiform" method="post" action="__CONF_SITE__admin/Role/permission" style=" padding: 15px;">
                <div class="text-c">
                    <input type="text" class="input-text" value="{$username}" style="width:250px" placeholder="输入用户"  name="username">
                    <button type="submit" class="btn btn-search radius"  name=""><i class="Hui-iconfont">&#xe665;</i> 搜用户</button>
                </div>
            </form>
        </div>
        <table class="table table-border table-bordered table-bg">
            <thead>
            <tr class="text-c">
                <th>用户名称</th>
                <th>权限</th>
                <th>是否显示版权</th>
                <th>创建时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {volist name="list" id="vo"}
            <tr class="text-c">
                <td>{$vo['username']}</td>
                <td>{:getUserAou($vo['uid'])}</td>
                <td>
                    <a href="javascript:;" onclick="UserCopyright(this,'{$vo.uid}')"><span class="label label-success radius">{:getUserCopyright($vo['uid'])}</span></a>
                </td>
                <td>{$vo['starttime']|date='Y-m-d H:i:s',###}</td>
                <td>
                    <a title="编辑" href="javascript:;" onclick="role_user_edit('{$vo.uid}')" class="ml-5" style="text-decoration:none">编辑</a>
                </td>
            </tr>
            {/volist}
            </tbody>
        </table>
    </article>
    <div class="n_page_no">
        {$list->render()}
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="/public/js/jquery-2.1.1.js"></script>
<script type="text/javascript">
    function role_user_edit(uid) {
        layer.open({
            type: 2,
            area: ['400px', '400px'],
            fix: false, //不固定
            maxmin: true,
            shade:0.4,
            title: '编辑权限',
            content: '__CONF_SITE__admin/role/permission_edit&uid='+uid,
            scrollbar:false,
            shadeClose:true,
        });
    }
    /*活动-停用*/
    function UserCopyright(obj,id){
        $.ajax({
            type : "post",
            url : "{:url('Role/usercopyright_edit')}",
            data : {
                "uid" : id,
            },
            dataType:"json",
            success : function(data) {
                if (data['code'] > 0) {
                    layer.msg('操作成功!',{icon: 1,time:1000},function () {
                        window.location.reload();
                    });
                }else{
                    layer.msg('操作失败' +
                        '!', {icon: 5, time: 1000});
                }
            }
        });
    }
</script>
{/block}